package com.studiofortress.sf.structure.intersection;  

import com.studiofortress.sf.util.structure.ImageActor;

/**
 * Represents the given Actor using it's image during
 * intersections. This takes into account transparent
 * pixels allowing perfect pixel collision between this
 * Actor and other Actors, regardless of how they are
 * represented.
 * @author Joseph Lenton
 * @version 08/08/2008
 */
public class ImageIntersection extends Intersection
{
    /**
     * Creates a new ImageIntersection which will represent the given Actor.
     * @param actor The Actor this Intersection will be working with, cannot be null.
     */
    public ImageIntersection(ImageActor actor)
    {
        super(actor);
    }
    
    @Override
    public boolean isIntersection(Intersection other)
    {
        return other.isIntersectionToImage(this);
    }
     
    @Override
    protected boolean isIntersectionToPixel(PixelIntersection other)
    {
        return Intersection.intersectionPixelToImage(other.getActor(), getActor());
    }
    
    @Override
    protected boolean isIntersectionToBounds(BoundsIntersection other)
    {
        return Intersection.intersectionBoundsToImage(other.getActor(), getActor());
    }
    
    @Override
    protected boolean isIntersectionToImage(ImageIntersection other)
    {
        return Intersection.intersectionImageToImage(getActor(), other.getActor());
    }
    
    @Override
    protected boolean isIntersectionToShape(ShapeIntersection other)
    {
        return Intersection.intersectionImageToShape(getActor(), other.getActor(), other.getShape());
    }
    
    @Override
    protected ImageActor getActor()
    {
        return (ImageActor)super.getActor();
    }
 }
 